import bdbdic
import time
import random
import testdata
def test( num ):
    q = bdbdic.FileDic()

    pre  = time.time()
    for i in xrange( num ):
        k=testdata.key + str( i )
        v=testdata.data + str(i)
        q[k] = v 
    used = time.time() - pre
    print 'w:', num, used, num/used

    pre = time.time()
    for i in xrange( num ):
        q.popitem()
    used = time.time() - pre
    print 'r:', num, used, num/used
    del q
#nums = [ 10, 100, 1000,  ]
nums = [ 1000, 10000, 20000, 50000, 100000 ]
for n in nums:
    test( n )
    print
